home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12733 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.IT.net!news
  2. From: gema001@pn.itnet.it (Antonio Romeo)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Processing text file
  5. Date: 2 Apr 1996 13:51:32 GMT
  6. Organization: CyberPress
  7. Message-ID: <4jrbd4$a19@dns1.IT.net>
  8. References: <4jr7l9$6on@harbinger.cc.monash.edu.au>
  9. NNTP-Posting-Host: gema001.pn.itnet.it
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.7
  13.  
  14. In article <4jr7l9$6on@harbinger.cc.monash.edu.au>, 
  15. nallan@yoyo.cc.monash.edu.au says...
  16. >
  17. >Hi everyone
  18. >I'm kind of new to c, so please be gentle.
  19. >I'm trying to write a program that reads a text file, a line at a 
  20. time, 
  21. >does some processing and outputs to another text file.
  22. >The input text file has the same format for every line with the 
  23. exception 
  24. >of on ocation the last field is sometimes blank.
  25. >The lines are not the same length.
  26. >
  27. >Can someone give me ideas on the best way to handle this.  I've tried 
  28. >few methods 
  29. >but I can't seem to get it to work.  My main problem is the variable 
  30. >length in the input file.
  31. Try using gets() function. This read a string from a file until '\n' 
  32. char.
  33. '\n' is not placed in string, so you can read entire line regardless 
  34. lenght.
  35.  
  36.  
  37. -- 
  38. Antonio Romeo - Rome - Italy
  39. e-mail: gema001@pn.itnet.it
  40.  
  41.